<%--                                                                       --%>
<%-- Copyright (c) 2004-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html-el.tld" prefix="html-el" %>
<%@ taglib uri="/WEB-INF/struts-bean-el.tld" prefix="bean-el" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>

<%
  String ctxPath = request.getContextPath();
%>

<script language="JavaScript">

//
//
//
function confirmDeleteAlert(form) {
  var ok = confirm('<bean-el:message key="mt.alert.confirm.delete" bundle="mt.messages"/>');
  return ok;
}

<%@ include file="/mc/common/jsutils.jsp" %>

</script>

<c:set var="deleteImg">
<img src="<%= ctxPath %>/mc/images/action/icon_delete.gif" width="15" height="15" border="0" class="actionIcon" alt="<bean-el:message key="image.alt.delete" bundle="mt.messages"/>" title="<bean-el:message key="image.alt.delete" bundle="mt.messages"/>">
</c:set>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">

      <html-el:form action="/mt/inbox.do">
        <html-el:hidden property="userId"/>

        <div class="pageTitle">
          <c:out value="${mtInboxView.map.fullName}"/>
        </div> 

        <div class="errorMessage"><html-el:errors bundle="mt.messages"/></div>

        <div class="pageSubtitle">
          <span class="left">
            <bean-el:message key="mt.inbox.pageSubtitle" bundle="mt.messages"/>
          </span>
          <span class="right">&nbsp;</span>
        </div> 

<c:if test="${not empty mtInboxView.map.alerts}">
      <div class="globalButtonWrap">
        <input type="button" name="selectAll" class="globalButton" value="<bean-el:message key="button.selectAll" bundle="ep.messages"/>"
          onclick="check(this.form.alertIds, this);">
        <input type="button" class="globalButton" value="<bean-el:message key="button.delete" bundle="mt.messages"/>"
          onclick="if (isAnyChecked(this.form.alertIds, '<bean-el:message key="mt.alert.atLeastOne" bundle="mt.messages"/>', '<bean-el:message key="mt.alerts.confirm.delete" bundle="mt.messages"/>')) doAction('/mt/alertDelete.do', this.form);">
      </div>
</c:if>

        <table class="dataTable" border="0" cellspacing="1" cellpadding="2" summary="user alerts inbox table" width="100%">
          <tr class="listHeader">
            <th id="Checkboxes">&nbsp;</th>
            <th id="Subject" align="left"><bean-el:message key="mt.inbox.header.subject" bundle="mt.messages"/></th>
            <th id="CreationDate" align="left"><bean-el:message key="mt.inbox.header.creationDate" bundle="mt.messages"/></th>
            <th id="Actions" align="left" width="10%"><bean-el:message key="mt.header.actions" bundle="mt.messages"/></th>
          </tr>
          <c:if test="${empty mtInboxView.map.alerts}">
            <tr class="listEven">
              <td colspan=6 align="center"><bean-el:message key="mt.inbox.noAlerts" bundle="mt.messages"/></td>
            </tr>
          </c:if>

          <c:if test="${not empty mtInboxView.map.alerts}">
            <c:forEach var="alert" items="${mtInboxView.map.alerts}" varStatus="index">
              <c:url var="viewUrl" value="/mt/alertView.do">
                <c:param name="alertName" value="${alert.map.alertName}"/>
                <c:param name="messageId" value="${alert.map.messageId}"/>
              </c:url>
              <c:url var="deleteUrl" value="/mt/alertDelete.do">
                <c:param name="alertName" value="${alert.map.alertName}"/>
                <c:param name="messageId" value="${alert.map.messageId}"/>
              </c:url>

              <c:choose>
                <c:when test="${(index.count + 1) % 2 == 0}">
              <tr class="listEven">
                </c:when>
                <c:otherwise>
              <tr class="listOdd">
                </c:otherwise>
              </c:choose>
                <td headers="Checkboxes" align="center"><input type="checkbox" name="alertIds" value="<c:out value="${alert.map.messageId}:${alert.map.alertName}"/>" onclick="update(this.form.alertIds, this.form.selectAll);"></td>
                <td headers="Subject"><a href="<c:out value="${viewUrl}"/>"><c:out value="${alert.map.subject}"/></a>&nbsp;</td>
                <td headers="CreationDate"><bean:write name="alert" property="creationDate" formatKey="format.datetime.short" bundle="mc.messages"/>&nbsp;</td>
                <td headers="Actions" width="10%"><a href="<c:out value="${deleteUrl}"/>" onclick="return confirmDeleteAlert(this.form)"><c:out value='${deleteImg}' escapeXml="false"/></a></td>
              </tr>
            </c:forEach>
          </c:if>
        </table>

      </html-el:form>
    </td>
  </tr>
</table>
